<?php
class Project extends Controller {

	function Project()
	{
		parent::Controller();	
		$this->users->checkAdmin();
		$this->load->helper('file');
	}

	//All the users management
	function reset() 
	{
		$this->db->truncate('comments'); 
		$this->db->truncate('designs'); 
		$this->db->truncate('discussions'); 
		$this->db->truncate('posts'); 
		$this->db->truncate('threads'); 
		$this->db->truncate('todos'); 
		$this->db->where('isadmin', '0');
		$this->db->delete('users'); 
		delete_files('./files');
		delete_files('./designs');
		redirect('project');
	}
	function delete ()
	{
			$user = $this->uri->segment(3);
			$this->db->where('id', $user);
			$this->db->delete('users'); 
			redirect('people');
	}
	function index() 
	{
		$data['query'] = $this->db->query('SELECT * FROM project');
		$template['content'] = $this->load->view('admin_project', $data, TRUE);
		$template['title'] = "Manage Project";
		$this->load->view('template', $template);
	}
	function title() {
		$this->db->set('title', $_POST['title']);
		$this->db->update('project');
		redirect('project');
	}
}
?>